package com.bobby.shop.util;

/**
 * @Description TODO
 * @Date 2020/7/10 12:24
 * @Created wenjunpei
 */
public enum ResponseCode {

    SUCCESS(200,"SUCCESS"),
    ERROR(400,"ERROR"),
    ARTICLE_ID_IS_NULL(401,"商品ID不能为空"),
    ARTICLE_ID_IS_ERROR(402,"商品ID异常"),
    ARTICLE_NUM_IS_NULL(403,"商品数量不能为空"),
    ARTICLE_NUM_IS_ERROR(404,"商品数量异常"),
    SHOPCAR_ID_IS_NULL(405,"购物车ID异常"),
    ARTICLE_STORAGE_IS_NOT_ENOUGHT(406,"超出商品库存"),
    PARAM_IS_ERROR(407,"参数异常");


    private final int code;
    private final String desc;

    // 这里使用default的修饰，只允许类内部及本包调用
    ResponseCode(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 暴露获取属性的方法
     *
     * @return
     */
    public int getCode() {
        return code;
    }
    public String getDesc() {
        return desc;
    }
}
